package com.jxnu.duewang.zmly.zmly.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;

import com.jxnu.duewang.zmly.R;
import com.jxnu.duewang.zmly.yangZhi.activity.LoginActivity;
import com.jxnu.duewang.zmly.yangZhi.activity.MySubActivity;
import com.jxnu.duewang.zmly.yangZhi.activity.PlayHistoryActivity;
import com.jxnu.duewang.zmly.yangZhi.activity.SettingActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyFragment extends Fragment implements View.OnClickListener{

    private RelativeLayout loginback,anchor,news,shopping,xibi,subscription,history,praised,
            points,free,store,order,coupon,game,carmode,hardware,friend,bind,feedback,setting;
    private RadioGroup record;
    private ImageView setting_img;

    public MyFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        FragmentManager fm = getFragmentManager();
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_my, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        setting_img = (ImageView) view.findViewById(R.id.setting_pressed);
        record = (RadioGroup) view.findViewById(R.id.record_RG);
        loginback = (RelativeLayout) view.findViewById(R.id.login_back);
        anchor = (RelativeLayout) view.findViewById(R.id.anchor);
        news = (RelativeLayout) view.findViewById(R.id.sixin);
        shopping = (RelativeLayout) view.findViewById(R.id.shoppingcart);
        xibi = (RelativeLayout) view.findViewById(R.id.xibi);
        subscription = (RelativeLayout) view.findViewById(R.id.collect);
        history = (RelativeLayout) view.findViewById(R.id.record);
        praised = (RelativeLayout) view.findViewById(R.id.praised);
        points = (RelativeLayout) view.findViewById(R.id.points);
        free = (RelativeLayout) view.findViewById(R.id.nicom);
        store = (RelativeLayout) view.findViewById(R.id.mall);
        order = (RelativeLayout) view.findViewById(R.id.order);
        coupon = (RelativeLayout) view.findViewById(R.id.coupon);
        game = (RelativeLayout) view.findViewById(R.id.game);
        carmode = (RelativeLayout) view.findViewById(R.id.carmode);
        hardware = (RelativeLayout) view.findViewById(R.id.intelligent_hardware);
        friend = (RelativeLayout) view.findViewById(R.id.find_friend);
        bind = (RelativeLayout) view.findViewById(R.id.bind);
        feedback = (RelativeLayout) view.findViewById(R.id.feedback);
        setting = (RelativeLayout) view.findViewById(R.id.setting);
        setting_img.setOnClickListener(this);
        record.setOnClickListener(this);
        loginback.setOnClickListener(this);
        anchor.setOnClickListener(this);
        news.setOnClickListener(this);
        shopping.setOnClickListener(this);
        xibi.setOnClickListener(this);
        subscription.setOnClickListener(this);
        history.setOnClickListener(this);
        praised.setOnClickListener(this);
        points.setOnClickListener(this);
        free.setOnClickListener(this);
        store.setOnClickListener(this);
        order.setOnClickListener(this);
        coupon.setOnClickListener(this);
        game.setOnClickListener(this);
        carmode.setOnClickListener(this);
        hardware.setOnClickListener(this);
        friend.setOnClickListener(this);
        bind.setOnClickListener(this);
        feedback.setOnClickListener(this);
        setting.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.setting_pressed:
                Intent intent = new Intent(getContext(),SettingActivity.class);
                startActivity(intent);
                break;
            case R.id.record_RG:
                Intent intent1 = new Intent(getContext(),LoginActivity.class);
                startActivity(intent1);
                break;
            case R.id.login_back:
                Intent intent2 = new Intent(getContext(),LoginActivity.class);
                startActivity(intent2);
                break;
            case R.id.anchor:
                Intent intent3 = new Intent(getContext(),LoginActivity.class);
                startActivity(intent3);
                break;
            case R.id.sixin:
                Intent intent4 = new Intent(getContext(),LoginActivity.class);
                startActivity(intent4);
                break;
            case R.id.shoppingcart:
                Intent intent5 = new Intent(getContext(),LoginActivity.class);
                startActivity(intent5);
                break;
            case R.id.xibi:
                Intent intent6 = new Intent(getContext(),LoginActivity.class);
                startActivity(intent6);
                break;
            case R.id.collect:
                Intent intent7 = new Intent(getContext(), MySubActivity.class);
                startActivity(intent7);
                break;
            case R.id.record:
                Intent intent8 = new Intent(getContext(), PlayHistoryActivity.class);
                startActivity(intent8);
                break;
            case R.id.praised:
                Intent intent9 = new Intent(getContext(),LoginActivity.class);
                startActivity(intent9);
                break;
            case R.id.points:
                Intent intent10= new Intent(getContext(),LoginActivity.class);
                startActivity(intent10);
                break;
            case R.id.nicom:
                Intent intent11= new Intent(getContext(),LoginActivity.class);
                startActivity(intent11);
                break;
            case R.id.mall:
                Intent intent12= new Intent(getContext(),LoginActivity.class);
                startActivity(intent12);
                break;
            case R.id.order:
                Intent intent13= new Intent(getContext(),LoginActivity.class);
                startActivity(intent13);
                break;
            case R.id.coupon:
                Intent intent14= new Intent(getContext(),LoginActivity.class);
                startActivity(intent14);
                break;
            case R.id.game:
                Intent intent15= new Intent(getContext(),LoginActivity.class);
                startActivity(intent15);
                break;
            case R.id.carmode:
                Intent intent16= new Intent(getContext(),LoginActivity.class);
                startActivity(intent16);
                break;
            case R.id.intelligent_hardware:
                Intent intent17= new Intent(getContext(),LoginActivity.class);
                startActivity(intent17);
                break;
            case R.id.find_friend:
                Intent intent18= new Intent(getContext(),LoginActivity.class);
                startActivity(intent18);
                break;
            case R.id.bind:
                Intent intent19= new Intent(getContext(),LoginActivity.class);
                startActivity(intent19);
                break;
            case R.id.feedback:
                Intent intent20= new Intent(getContext(),LoginActivity.class);
                startActivity(intent20);
                break;
            case R.id.setting:
                Intent intent21= new Intent(getContext(),SettingActivity.class);
                startActivity(intent21);
                break;
        }
    }
}